﻿using NLipsum.Core;
using sql_data_generator.FieldOptions;
using sql_data_generator.Generators;

namespace sql_data_generator.Randomizers
{
    class RandomizerTextWords : BaseRandomizer<FieldOptionsTextWords>, IRandomizer
    {
        private readonly RandomIntegerGenerator _integerGenerator;
        private readonly LipsumGenerator _generator = new LipsumGenerator();

        public RandomizerTextWords(FieldOptionsTextWords options)
            : base(options)
        {
            //_fieldOptions = options;

            _integerGenerator = new RandomIntegerGenerator(options.Min, options.Max + 1);
        }

        public object GetData()
        {
            return IsNull() ? null : string.Join(" ", _generator.GenerateWords(_integerGenerator.Generate()));
        }
    }
}